#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QPainter>
#include <QTimer>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();
protected:
    void paintEvent(QPaintEvent *event) override;
    void drawBackground(QPainter &painter);
    void initCanvas(QPainter &painter);
    void drawMiddleCircle(QPainter &painter, int radius);
    void drawCurrentSpeed(QPainter &painter);
    void drawScale(QPainter &painter,int radius);
    void drawScaleText(QPainter &painter, int radius);
    void drawPointer(QPainter &painter, int length);
    void drawSpeedPie(QPainter &painter, int radius);
    void startSpeed();
    void drawEllipseInnerBlack(QPainter &painter, int radius);
    void drawEllipseInnerShine(QPainter &painter, int radius);
    void drawEllipseOutterShine(QPainter &painter, int radius);
    void drawLogo(QPainter &painter, int radius);
private:
    Ui::Widget *ui;
    QTimer *timer;
    int currentValue;
    int mark;
    //每一个刻度所占用的度数
    double angle;
    //起始角度
    int StartingAngle;
};
#endif // WIDGET_H
